<%@page import="br.com.Modelo.UsuarioCliente"%>
<%@page import="java.util.List"%>
<%@page import="br.com.Modelo.Produto"%>
<%@page import="br.com.Modelo.UsuarioComerciante"%>
<%@page import="br.com.Modelo.Pagina"%>
<%@page import="br.com.Modelo.Endereco"%>
<%@page import="br.com.Dao.UsuarioClienteDao"%>
<%@page import="br.com.Dao.UsuarioComercianteDao"%>
<%@page import="br.com.Dao.ProdutoDao"%>
<%@page import="br.com.Dao.PaginaDao"%>
<%@page import="br.com.Dao.EnderecoDao"%>
<%@page import="java.io.IOException"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>SB Admin - Bootstrap Admin Template</title>

    <!-- Bootstrap Core CSS -->
    <link href="../bootstrap/css/bootstrap.min.css" rel="stylesheet">

    <!-- Custom CSS -->
    <link href="../public/css/sb-admin.css" rel="stylesheet">

    <!-- Morris Charts CSS -->
    <link href="../public/css/plugins/morris.css" rel="stylesheet">

    <!-- Custom Fonts -->
    <link href="../public/font-awesome-4.1.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    
      
<script type="text/javascript" src="../public/js/jquery.js"></script>
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    
    
    
    <style>
    .btn-primary {
	color: #ffffff;
	text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
	background-color: #229ac8;
	background-image: linear-gradient(to bottom, #23a1d1, #1f90bb);
	background-repeat: repeat-x;
	border-color: #1f90bb #1f90bb #145e7a;
}

.btn-primary:hover,.btn-primary:active,.btn-primary.active,.btn-primary.disabled,.btn-primary[disabled]
	{
	background-color: #1f90bb;
	background-position: 0 -15px;
}
    
    
    </style>
    
     <script type="text/javascript">


$(document).ready(function(){
	$("#mytable #checkall").click(function () {
	        if ($("#mytable #checkall").is(':checked')) {
	            $("#mytable input[type=checkbox]").each(function () {
	                $(this).prop("checked", true);
	            });

	        } else {
	            $("#mytable input[type=checkbox]").each(function () {
	                $(this).prop("checked", false);
	            });
	        }
	    });
	});

	 $(function () {
	            $("[rel='tooltip']").tooltip();
	        });


</script>
</head>

<body>



	<%
		///allow access only if session exists
	    
		String[] id = (String[]) session.getAttribute("user");
	    
		UsuarioCliente userCliente = null;
		UsuarioComerciante userComerciante = null;

		UsuarioComercianteDao dao = new UsuarioComercianteDao();
		if (id != null) {
			
			if (id[1].equals("1")) {


			} else {

		   userComerciante = dao.validaAutenticacaoUser(
		Long.parseLong(id[0]), Integer.parseInt(id[1]));
			}
		}
		String userName = null;
		String sessionID = null;
		
		if (userComerciante != null) {
			Pagina pagina = new Pagina();
			PaginaDao paginaDao= new PaginaDao();
			//out.println(userComerciante.getIdPagina());
			pagina = paginaDao.getPagina(userComerciante.getIdPagina());
			
			if(pagina != null){
		  //  pagina = new PaginaDao().getPagina(userComerciante.getIdPagina());
	%>




	<div id="wrapper">

		<!-- Navigation -->
		<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
		<!-- Brand and toggle get grouped for better mobile display -->
		<div class="navbar-header">
			<button type="button" class="navbar-toggle" data-toggle="collapse"
				data-target=".navbar-ex1-collapse">
				<span class="sr-only">Toggle navigation</span> <span
					class="icon-bar"></span> <span class="icon-bar"></span> <span
					class="icon-bar"></span>
			</button>
			<a class="navbar-brand" href="">Painel Administrativo</a>
		</div>
		<!-- Top Menu Items -->
		<ul class="nav navbar-right top-nav">


				<li class="dropdown"><a class="dropdown-toggle" role="button"
				data-toggle="dropdown" href="#"> <i
					class="glyphicon glyphicon-user"></i> <%=userComerciante.getLogin()%>
					<span class="caret"></span></a>
				<ul id="g-account-menu" class="dropdown-menu" role="menu">
					<li><a href="#">Meu Perfil</a></li>
					<li><a href="#"><i class="glyphicon glyphicon-lock"></i>
							Sair</a></li>
				</ul></li>
		</ul>
		<!-- Sidebar Menu Items - These collapse to the responsive navigation menu on small screens -->
		<div class="collapse navbar-collapse navbar-ex1-collapse">
			<ul class="nav navbar-nav side-nav">
				<li class="co"><a href="/plataforma_marketing"><img
						src="/plataforma_marketing/img/logo.png"></img> </a></li>

				<li class=""><a href="admin_loja.jsp"><i
						class="fa fa-fw fa-file"></i> Configurações Pagina</a></li>

				<li><a href="javascript:;" data-toggle="collapse"
					data-target="#demo"><i class="fa fa-fw fa-arrows-v"></i>
						Produto<i class="fa fa-fw fa-caret-down"></i></a>

					<ul id="demo" class="collapse">
						<li><a href="cadastrar_produto.jsp"><i
								class="glyphicon glyphicon-plus"></i> Cadastrar Produto</a></li>

						<li><a href="editar_produto.jsp"><i
								class="glyphicon glyphicon-cog"></i> Editar Produto</a></li>

					</ul></li>
				<li><a href="config_admin.jsp"><i
						class="glyphicon glyphicon-plus"></i> Configurações Admin</a></li>


  	<li id="ir"><a href="/plataforma_marketing/<%=pagina.getPagina()%>"><i class="glyphicon glyphicon-transfer"></i>
					  Ir para Pagina</a></li>
               
                

			</ul>
		</div>
		<!-- /.navbar-collapse --> </nav>

		<div id="page-wrapper">

			<div class="container-fluid">

				<!-- Page Heading -->
				<div class="row">


					<div class="panel panel-default">
						<div class="panel-heading">
							<div class="panel-title">
								<i class="glyphicon glyphicon-wrench pull-right"></i>
								<h4>Editar Produto</h4>
							</div>
						</div>
						<div class="panel-body">


                                                <div class="col-md-12">
      
        <div class="table-responsive">
        
                
              <table id="mytable" class="table table-bordred table-striped">
                   
                   <thead>
                   
                   <th><input type="checkbox" id="checkall" /></th>
                   <th>Nome</th>
                    <th>Descri</th>
                     <th>valor</th>
                      <th>Edit</th>
                       <th>Delete</th>
                   </thead>
    <tbody>
    
    <tr>
    <td><input type="checkbox" class="checkthis" /></td>
    <td>teste</td>
    <td>teste</td>
    <td>45.00</td>
    <td><p><button class="btn btn-primary btn-xs" data-title="Edit" data-toggle="modal" data-target="#edit" data-placement="" rel="tooltip"><span class="glyphicon glyphicon-pencil"></span></button></p></td>
    <td><p><button class="btn btn-danger btn-xs" data-title="Delete" data-toggle="modal" data-target="#delete" data-placement="button" rel="tooltip"><span class="glyphicon glyphicon-trash"></span></button></p></td>
    </tr>
    
        <tr>
    <td><input type="checkbox" class="checkthis" /></td>
    <td>teste</td>
    <td>teste</td>
    <td>45.00</td>
    <td><p><button class="btn btn-primary btn-xs" data-title="Edit" data-toggle="modal" data-target="#edit" data-placement="" rel="tooltip"><span class="glyphicon glyphicon-pencil"></span></button></p></td>
    <td><p><button class="btn btn-danger btn-xs" data-title="Delete" data-toggle="modal" data-target="#delete" data-placement="button" rel="tooltip"><span class="glyphicon glyphicon-trash"></span></button></p></td>
    </tr>
    
        <tr>
    <td><input type="checkbox" class="checkthis" /></td>
    <td>teste</td>
    <td>teste</td>
    <td>45.00</td>
    <td><p><button class="btn btn-primary btn-xs" data-title="Edit" data-toggle="modal" data-target="#edit" data-placement="" rel="tooltip"><span class="glyphicon glyphicon-pencil"></span></button></p></td>
    <td><p><button class="btn btn-danger btn-xs" data-title="Delete" data-toggle="modal" data-target="#delete" data-placement="button" rel="tooltip"><span class="glyphicon glyphicon-trash"></span></button></p></td>
    </tr>

    

   
    
    </tbody>
        
</table>

</div>
</div>

<div class="modal fade" id="edit" tabindex="-1" role="dialog" aria-labelledby="edit" aria-hidden="true">
      <div class="modal-dialog">
    <div class="modal-content">
          <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        <h4 class="modal-title custom_align" id="Heading">Edit Your Detail</h4>
      </div>
          <div class="modal-body">
          <div class="form-group">
        <input class="form-control " type="text" placeholder="Mohsin">
        </div>
        <div class="form-group">
        
        <input class="form-control " type="text" placeholder="Irshad">
        </div>
        <div class="form-group">
        <textarea rows="2" class="form-control" placeholder="CB 106/107 Street # 11 Wah Cantt Islamabad Pakistan"></textarea>
    
        
        </div>
      </div>
          <div class="modal-footer ">
        <button type="button" class="btn btn-warning btn-lg" style="width: 100%;"><span class="glyphicon glyphicon-ok-sign"></span> Update</button>
      </div>
        </div>
    <!-- /.modal-content --> 
  </div>
      <!-- /.modal-dialog --> 
    </div>


<div class="modal fade" id="delete" tabindex="1" role="dialog" aria-labelledby="edit" aria-hidden="true">
      <div class="modal-dialog">
    <div class="modal-content">
          <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        <h4 class="modal-title custom_align" id="Heading">Delete this entry</h4>
      </div>
          <div class="modal-body">
       
       <div class="alert alert-warning"><span class="glyphicon glyphicon-warning-sign"></span> Are you sure you want to delete this Record?</div>
       
      </div>
        <div class="modal-footer ">
        <button type="button" class="btn btn-success" ><span class="glyphicon glyphicon-ok-sign"></span> Yes</button>
        <button type="button" class="btn btn-default" data-dismiss="modal"><span class="glyphicon glyphicon-remove"></span> No</button>
      </div>
        </div>
    <!-- /.modal-content --> 
  </div>
      <!-- /.modal-dialog --> 
    </div>

						</div>
						<!--/panel content-->
					</div>
					<!--/panel-->



				</div>
				<!-- /.row -->



			</div>
			<!-- /.container-fluid -->

		</div>
		<!-- /#page-wrapper -->

	</div>
	<!-- /#wrapper -->

  
    <!-- jQuery Version 1.11.0 -->

	<script src="../bootstrap/js/jquery-1.11.0.js"></script>
	<script src="../bootstrap/js/bootstrap.js"></script>



    
    <%
		}}
	%>

</body>

</html>